<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload=function(){
	// 1.抓取元素
    var btn = document.getElementById('btn');
    var img = document.getElementById('img');
    var c = 0;
    // 2.绑定事件
    btn.onclick = function(){
    	function run(){
    	// 通过变量控制效果
    		 if(c==0){
        	img.src = "fj.jpg";
        	c=1;
        }else{
        	img.src = "mv.jpg";
        	c=0;
        }
      }
   	    timer = setInterval(run,10);
    }
    


}
</script>
</head>

<body>
	<button id="btn">切换</button>
	<br />
	<img id="img" src="mv.jpg" alt="" />
</body>
</html>
